import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthComponent } from './pages/auth/auth.component';
import { ChatComponent } from './pages/chat/chat.component';
import { SettingComponent } from './pages/setting/setting.component';
import { UserComponent } from './pages/user/user.component';
import { AuthGard } from './@core/guard/auth.gard';

const routes: Routes = [
  {
    path: 'auth',
    component: AuthComponent,
    loadChildren: () =>
      import('./pages/auth/auth.module').then((mod) => mod.AuthModule)
  },
  {
    path: 'chat',
    component: ChatComponent,
    loadChildren: () =>
      import('./pages/chat/chat.module').then((mod) => mod.ChatModule),
    canActivate: [AuthGard]
  },
  { path: 'setting', component: SettingComponent, canActivate: [AuthGard] },
  { path: 'user', component: UserComponent, canActivate: [AuthGard] }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
  providers: []
})
export class AppRoutingModule {}
